#include "SudokuContextMenuButton.h"

#include <QMouseEvent>
#include <QCoreapplication>

SudokuContextMenuButton::SudokuContextMenuButton(QWidget* parent) : QToolButton(parent)//QPushButton(parent)
{
}

/*SudokuContextMenuButton::SudokuContextMenuButton(const QString& text, QWidget* parent) :
        QPushButton(text, parent)
{
}*/

void SudokuContextMenuButton::mouseReleaseEvent(QMouseEvent *event)
{
    // this one triggers the action and untoggles the button
    QToolButton::mouseReleaseEvent(event);
    // this one forwards the event to the parent
    QWidget::mouseReleaseEvent(event);

    QKeyEvent *e = new QKeyEvent(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier);
    QCoreApplication::postEvent(this->parent(), e);

    //emit clicked();
    //event->ignore();
}
